<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="page-title">
    <h1><?php echo $this->__('Review Order') ?></h1>
    <div class="titlebot"></div>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

<?php if ($this->getShippingAddress()): ?>
<div class="info-set col2-set">
    <h2 class="legend"><?php echo $this->__('Shipping Information') ?></h2>
    <div class="col-1">
        <div class="box">
            <div class="box-title">
                <h3><?php echo $this->__('Shipping Address') ?><span class="separator"><?php if ($this->getCanEditShippingAddress()):?> | </span><a href="<?php echo $this->getUrl('paypal/express/edit') ?>"><?php echo $this->__('Change Shipping Address') ?></a><?php endif;?></h3>
            </div>
            <div class="box-content">
                <address>
                    <?php echo $this->getShippingAddress()->getFormated(true) ?>
                </address>
            </div>
        </div>
    </div>
    <div class="col-2">
        <div class="box">
            <div class="box-title">
                <h3><?php echo $this->__('Shipping Method') ?></h3>
            </div>
            <div class="box-content">
                <?php if ($this->isVirtual()): ?>
                    <p><strong><?php echo $this->__('No shipping method required.') ?></strong></p>
                <?php else: ?>
                    <?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
                        <p><strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong></p>
                    <?php else: ?>
                    <form method="post" id="shipping_method_form" action="<?php echo $this->getUrl($this->getPaypalActionPrefix().'/express/saveShippingMethod') ?>">
                        <fieldset>
                            <select name="shipping_method" id="shipping_method" style="width:250px;" class="required-entry">
                            <?php if(!$this->getAddressShippingMethod()): ?>
                                <option value=""><?php echo $this->__('Please select a shipping method...') ?></option>
                            <?php endif ?>
                            <?php foreach ($_shippingRateGroups as $code => $_rates): ?>
                                <optgroup label="<?php echo $this->getCarrierName($code) ?>" style="font-style:normal;">
                                <?php foreach ($_rates as $_rate): ?>
                                   <?php if ($_rate->getErrorMessage()): ?>
                                        <option value="">
                                            <?php echo $_rate->getErrorMessage() ?>
                                        </option>
                                   <?php else: ?>
                                       <option value="<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()): ?> selected="selected"<?php endif ?> style="margin-left:16px;">
                                            <?php echo $_rate->getMethodTitle() ?> -

                                            <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
                                            <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>

                                            <?php echo $_excl; ?>
                                            <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
                                                (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
                                            <?php endif; ?>
                                       </option>
                                   <?php endif ?>
                                <?php endforeach; ?>
                                </optgroup>
                            <?php endforeach; ?>
                            </select>
                            <p class="actions">
<!--                                <button id="update_shipping_method_submit" type="submit" class="button"><span><span><?php echo $this->__('Update Shipping Method') ?></span></span></button>-->
                                <button id="update_shipping_method_submit" type="submit" class="btnnew floatright"><span><?php echo $this->__('Update Shipping Method') ?></span></button>
                            </p>
                        </fieldset>
                    </form>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<?php endif; ?>

 <div class="clstoppadding"><div class="info-set col2-set floatleft">
    <!--<h2 class="legend"><?php echo $this->__('Billing Information') ?></h2>
    <div class="col-1">
        <div class="box">
            <div class="box-title">
                <h3><?php echo $this->__('Payment Method') ?> <span class="separator">|</span> <a href="<?php echo $this->getUrl($this->getPaypalActionPrefix().'/express/edit') ?>"><?php echo $this->__('Change Payment Method') ?></a></h3>
            </div>
        </div>
    </div>-->
   <div class="col-2 " id="shopping_pay">
        <div class="box">
            <div class="box-title">
                <h3 class="shopping_cart"><?php echo $this->__('Billing Address') ?></h3>
            </div>
            <div class="box-content">
                <address>
                    <?php echo $this->getBillingAddress()->getFormated(true) ?><br />
                    <strong><?php echo $this->__(' Email: %s', $this->getBillingAddress()->getEmail()) ?></strong>
                </address>
            </div>
        </div>
    </div>
</div>

<div class="info-set floatright">
    <h2 class="legend shopping_cart" ><?php echo $this->__('Items in Your Shopping Cart') ?><span class="separator shopping_cart"> | </span><a href="<?php echo $this->getUrl('checkout/cart') ?>" class="shopping_cart"><?php echo $this->__('Edit Shopping Cart') ?></a></h2>
    <div id="details-reload">
        <?php echo $this->getChildHtml('details') ?>
    </div>
</div></div>
<form method="post" id="order_review_form" action="<?php echo $this->getPlaceOrderUrl() ?>">
    <div class="buttons-set buttons-set-order" id="review-buttons-container">
<!--        <button id="review_button" value="" title="<?php echo $this->__('Place an Order') ?>" class="button btn-checkout place_order"><span></span></button>
        <button type="submit" id="review_submit" value="<?php echo $this->__('Place an Order') ?>" title="<?php echo $this->__('Place an Order') ?>" class="button btn-checkout"><span><span><?php echo $this->__('Place an Order') ?></span></span></button>-->

        <button type="submit" id="review_submit" value="<?php echo $this->__('Place an Order') ?>" title="<?php echo $this->__('Place an Order') ?>" class="btnnew flostright"><span><?php echo $this->__('Place an Order') ?></span></button>
        <span class="please-wait" id="review-please-wait" style="display:none;">
            <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting order information...') ?>" title="<?php echo $this->__('Submitting order information...') ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
        </span>
    </div>
</form>
<script type="text/javascript">
//<![CDATA[
// submit buttons are not needed when submitting with ajax
$('review_submit').hide();
if ($('update_shipping_method_submit')) {
    $('update_shipping_method_submit').hide();
}

PayPalExpressAjax = new OrderReviewController($('order_review_form'), $('review_button'),
    $('shipping_method'), $('shipping_method_form'), 'details-reload'
);
PayPalExpressAjax.addPleaseWait($('review-please-wait'));
//]]>
</script>
